package excercise;

public class EX07_32번 {

	//주민번호 유효성 검사
	//123456-1234567
	//1*2+2*3+3*4+4*5+5*6+6*7
	//1*8+2*9+3*2+4*3+5*4+6*5
	public static void main(String[] args) {
		
         long jumin=1234567L;
         int key=0;
         int total=0;
        //  int key=(int)(jumin/ 100000000000L);
         // System.out.println(key);
          
         // key=(int)(jumin/100000000000L);
          //System.out.println(key);
          //System.out.println(key-10);
	      
         // key=(int)(jumin/10000000000L);
          //System.out.println(key);
          //System.out.println(key-100-20);
          
           	
          //key=(int)(jumin/1000000000L);
          //System.out.println(key);
          //System.out.println(key-1000-200-30);
          
          // 123456
          // 123456/100000=1
          // 123456%(1*100000)=23456
	     
           //  23456/ 10000=2
          //   23456 % (2*10000)=3456
         
          //  3456/1000=3
          //  3456 %(3*1000)= 456 
          
         
         
         //첫째
      /*   key=(int)(jumin/ 100000000000L);
	      total=total + (key*2);
	     if (key>0) jumin=jumin %(key*100000000000L);
	      System.out.println(jumin);
	      
	     //둘쩨
	      key=(int)(jumin/ 10000000000L);
	      total=total + (key*3);
	      jumin=jumin %(key*10000000000L);
	      System.out.println(jumin);
	      
	      //세째
	      key=(int)(jumin/ 1000000000L);
	      total=total + (key*4);
	      jumin=jumin %(key*1000000000L);
	      System.out.println(jumin);
	      //네째
	      key=(int)(jumin/ 100000000L);
	      total=total + (key*5);
	      jumin=jumin %(key*100000000L);
	      System.out.println(jumin);
	      //다섯째
	      key=(int)(jumin/ 100000000L);
	      total=total + (key*6);
	      jumin=jumin %(key*100000000L);
	      System.out.println(jumin);
	      //여섯째
	      key=(int)(jumin/ 100000000L);
	      total=total + (key*7);
	      jumin=jumin %(key*100000000L);
	      System.out.println(jumin);
	      //일곱
	      key=(int)(jumin/ 10000000L);
	      total=total + (key*8);
	      jumin=jumin %(key*10000000L);
	      System.out.println(jumin);
	      //여덜
	      key=(int)(jumin/ 10000000L);
	      total=total + (key*9);
	      jumin=jumin %(key*1000000L);
	      System.out.println(jumin);
	      //아홉
	      key=(int)(jumin/ 100000L);
	      total=total + (key*10);
	      jumin=jumin %(key*100000L);
	      System.out.println(jumin);
	      //열
	     
	      key=(int)(jumin/ 10000L);
	      total=total + (key*10);
	      jumin=jumin %(key*10000L);
	      System.out.println(jumin);
	      //열하나
	      
	      key=(int)(jumin/ 10000L);
	      total=total + (key*10);
	      jumin=jumin %(key*10000L);
	      System.out.println(jumin);
	      //열둘
	      key=(int)(jumin/ 10000L);
	      total=total + (key*10);
	      jumin=jumin %(key*10000L);
	      System.out.println(jumin);
	      //열셋
	      
	      
	      
	    
	      
	      
	      
	     key=(int)(jumin/10L);
	     total=total+(key*5);
	     jumin=jumin%(key*10L);
	    
	     
	     */
	     
	     
	     
	  
	     
	     
	     //반복문으로 처리 
	     // System.out.println(Math.pow(10, 12) );
	     
	     
	     for(int pow=12, prime=2 ; pow >=1; --pow, ++prime){
	    	 long divider=(long)Math.pow(10, pow);    
	         if (prime >9) prime=2; 
	         
	         key=(int)(jumin/ divider);
	         total=total + (key* (int) prime);
	          if (key>0) jumin=jumin %(key*divider);
	       }
	
	      System.out.println(jumin);            

	     
	     
	     
	
	
	}//
	
	

}//
